package com.rtx.wms.std.bak.job;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.rtx.api.annotation.RtxJobAnnotation;
import com.rtx.api.quartz.job.BaseJob;
import com.rtx.wms.std.bak.service.BakLogService;
import com.rtx.wms.std.common.service.CommonService;

@SuppressWarnings("all")
@Component
@DisallowConcurrentExecution
@RtxJobAnnotation(jobName = "BakLogJob",description = "备份日志表",cron = "0 0 23 * * ?")
public class BakLogJob implements BaseJob {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    BakLogService bakService;
    
    @Autowired
    private CommonService commonService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
    	//备份日志主表
    	String tablename_1 = "pl_api_request_log";
    	String dateColumn_1 = "ins_time";
    	String otherCondition_1 = "";
    	int day_1 = -10;//备份10天之前的数据
    	bakService.handleTableBak("ris_edi_dev",tablename_1, dateColumn_1, otherCondition_1,day_1);
    	
    	//备份日志从表
    	String tablename_2 = "pl_api_request_content_log";
    	String dateColumn_2 = "ins_time";
    	String otherCondition_2 = "";
    	int day_2 = -10;//备份10天之前的数据
    	bakService.handleTableBak("ris_edi_dev",tablename_2, dateColumn_2, otherCondition_2,day_2);

    }
}
